from appium import webdriver
import logging
from wechat_add.page.main_page import MainPage
from faker import Faker
import yaml
class App:
    def start(self):

        #启动app
        #desired_caps = {}
        with open("./app1.yaml","r",encoding = "utf =8") as f:
            desired_caps = yaml.safe_load(f)

        # desired_caps['platformName'] = 'Android'
        # desired_caps['platformVersion'] = '6.0'
        # desired_caps['deviceName'] = '127.0.0.1:7555'
        # desired_caps['appPackge'] = 'com.tencent.wework'
        # desired_caps['appActivity'] = '.launch.WwMainActivity'
        # # 累计保留上次登录或者操作过关闭窗体等操作
        # desired_caps['noReset'] = 'true'
        # # 跳过安装，权限设置等操作
        # desired_caps['skipDeviceInitialization'] = 'true'
        # # 设置可输入中文
        # desired_caps['unicodeKeyBoard'] = 'true'
        # # 设置可输入中文
        # desired_caps['resetKeyBoard'] = 'true'
        self.driver = webdriver.Remote("http://127.0.0.1:4723/wd/hub", desired_caps)
        self.driver.implicitly_wait(5)
        return self
    def restart(self):
        pass

    def stop(self):
        pass

    def goto_main(self):
        return MainPage(self.driver)
